package org.ipmsg.core;

public interface Protocol {
    //header
    int VERSION = 0x0001;
    int DEFAULT_PORT = 0x0979;
    //mask
    long MODE_MASK = 0x000000ffL;
    long OPT_MASK = 0xffffff00L;
    //command
    /**
     * 不进行任何操作
     */
    long NOOPERATION = 0x00000000L;
    /**
     * 用户上线
     */
    long BR_ENTRY = 0x00000001L;
    /**
     * 用户退出
     */
    long BR_EXIT = 0x00000002L;
    /**
     * 通报在线
     */
    long ANSENTRY = 0x00000003L;
    /**
     * 改变离开状态
     */
    long BR_ABSENCE = 0x00000004L;
    /**
     * 搜索有效主机
     */
    long BR_ISGETLIST = 0x00000010L;
    /**
     * 主机列表发送通知
     */
    long OKGETLIST = 0x00000011L;
    /**
     * 主机列表发送请求
     */
    long GETLIST = 0x00000012L;
    /**
     * 发送主机列表
     */
    long ANSLIST = 0x00000013L;
    long BR_ISGETLIST2 = 0x00000018L;
    /**
     * 发送消息
     */
    long SENDMSG = 0x00000020L;
    /**
     * 通报收到消息
     */
    long RECVMSG = 0x00000021L;
    /**
     * 消息阅读通知
     */
    long READMSG = 0x00000030L;
    /**
     * 消息丢弃通知
     */
    long DELMSG = 0x00000031L;
    /**
     * 消息阅读确认通知
     */
    long ANSREADMSG = 0x00000032L;
    /**
     * 获得版本信息
     */
    long GETINFO = 0x00000040L;
    /**
     * 发送版本信息
     */
    long SENDINFO = 0x00000041L;
    /**
     * 获得离开状态
     */
    long GETABSENCEINFO = 0x00000050L;
    /**
     * 发送离开状态
     */
    long SENDABSENCEINFO = 0x00000051L;
    /**
     * 请求通过TCP传输文件
     */
    long GETFILEDATA = 0x00000060L;
    /**
     * 停止接收文件
     */
    long RELEASEFILES = 0x00000061L;
    /**
     * 请求传输文件夹
     */
    long GETDIRFILES = 0x00000062L;
    /**
     * 获得RSA公钥
     */
    long GETPUBKEY = 0x00000072L;
    /**
     * 返回RSA公钥
     */
    long ANSPUBKEY = 0x00000073L;
    /*  option for all command  */
    /**
     * 离开状态
     */
    long ABSENCEOPT = 0x00000100L;
    long SERVEROPT = 0x00000200L;
    long DIALUPOPT = 0x00010000L;
    /**
     * 传送文件选项
     */
    long FILEATTACHOPT = 0x200000L;
    long ENCRYPTOPT = 0x00400000L;
    long UTF8OPT = 0x00800000L;
    /*  option for send command  */
    /**
     * 传送检查(需要对方返回确认信息)
     */
    long SENDCHECKOPT = 0x00000100L;
    long SECRETOPT = 0x00000200L;
    long BROADCASTOPT = 0x00000400L;
    long MULTICASTOPT = 0x00000800L;
    long NOPOPUPOPT = 0x00001000L;
    long AUTORETOPT = 0x00002000L;
    long RETRYOPT = 0x00004000L;
    long PASSWORDOPT = 0x00008000L;
    long NOLOGOPT = 0x00020000L;
    long NEWMUTIOPT = 0x00040000L;
    long NOADDLISTOPT = 0x00080000L;
    long READCHECKOPT = 0x00100000L;
    long SECRETEXOPT = (READCHECKOPT | SECRETOPT);
    /* encryption flags for encrypt command */
    long RSA_512 = 0x00000001L;
    long RSA_1024 = 0x00000002L;
    long RSA_2048 = 0x00000004L;
    long RC2_40 = 0x00001000L;
    long RC2_128 = 0x00004000L;
    long RC2_256 = 0x00008000L;
    long BLOWFISH_128 = 0x00020000L;
    long BLOWFISH_256 = 0x00040000L;
    long AES_128 = 0x00080000L;
    long SIGN_MD5 = 0x10000000L;
    long SIGN_SHA1 = 0x20000000L;
    /* file types for fileattach command */
    /**
     * 普通文件
     */
    long FILE_REGULAR = 0x00000001L;
    /**
     * 目录文件
     */
    long FILE_DIR = 0x00000002L;
    /**
     * 	返回上一级目录
     */
    long FILE_RETPARENT = 0x00000003L;
    long FILE_SYMLINK = 0x00000004L;
    long FILE_CDEV = 0x00000005L;	// for UNIX
    long FILE_BDEV = 0x00000006L;	// for UNIX
    long FILE_FIFO = 0x00000007L;	// for UNIX
    long FILE_RESFORK = 0x00000010L;	// for Mac   
/* file attribute options for fileattach command */
    /**
     * 只读文件
     */
    long FILE_RONLYOPT = 0x00000100L;
    /**
     * 隐藏文件
     */
    long FILE_HIDDENOPT = 0x00001000L;
    long FILE_EXHIDDENOPT = 0x00002000L;	// for MacOS X
    /**
     * 存档文件
     */
    long FILE_ARCHIVEOPT = 0x00004000L;
    /**
     * 系统文件
     */
    long FILE_SYSTEMOPT = 0x00008000L;

    /* extend attribute types for fileattach command */
    long FILE_UID = 0x00000001L;
    long FILE_USERNAME = 0x00000002L;	// uid by string
    long FILE_GID = 0x00000003L;
    long FILE_GROUPNAME = 0x00000004L;	// gid by string
    long FILE_PERM = 0x00000010L;	// for UNIX
    long FILE_MAJORNO = 0x00000011L;	// for UNIX devfile
    long FILE_MINORNO = 0x00000012L;	// for UNIX devfile
    long FILE_CTIME = 0x00000013L;	// for UNIX
    long FILE_MTIME = 0x00000014L;
    long FILE_ATIME = 0x00000015L;
    long FILE_CREATETIME = 0x00000016L;
    long FILE_CREATOR = 0x00000020L;	// for Mac
    long FILE_FILETYPE = 0x00000021L;	// for Mac
    long FILE_FINDERINFO = 0x00000022L;	// for Mac
    long FILE_ACL = 0x00000030L;
    long FILE_ALIASFNAME = 0x00000040L;  // alias fname
    long FILE_UNICODEFNAME = 0x00000041L;// UNICODE fname
    String MSGFILE_SEPARATOR = "\000";  // \0NUL 空
    String FILELIST_SEPARATOR = "\007"; // \a 蜂鸣
    String HOSTLIST_SEPARATOR = "\007"; // \a 蜂鸣
    String HOSTLIST_DUMMY = "\010";     // \b 退格
}
